/**
 * 统一上传图片业务代码
 */

const db = require("../db/db")
const initModel = require("../models/init-models")
const { user, scrip, middle } = initModel(db);
const { Op } = require("sequelize");

// 引入封装好的七牛
const qn = require("../comment/qiniu");

module.exports = {
  upload: async (req, res) => {
    try {
      qn.upImg(req, function (result) {
        if (result.status == 0) {
          res.send({
            status: 200,
            msg: "上传成功",
            data: result.data
          })
        } else {
          res.send({
            status: 200,
            msg: "上传失败"
          })
        }
      });
    } catch (err) {
      if (err) {
        console.log('trycatch报错====', err);
      }
    }
    // res.send("324")
  }
} 